home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / MacInterface / resources.icl < prev    next >
Encoding:
Modula Implementation  |  1996-02-22  |  1.4 KB  |  48 lines  |  [TEXT/3PRM]

  1. implementation module resources;
  2.  
  3. from mac_types import Handle,Toolbox;
  4.  
  5. // system 7.0 or later
  6. HOpenResFile :: !Int !Int !{#Char} !Int !Toolbox -> (!Int,!Toolbox);
  7. HOpenResFile vRefNum dirID fileName permission t
  8. = code (vRefNum=R2W,dirID=L,fileName=S,permission=D1,t=U)(refNum=W,t2=Z){
  9.     instruction 0x1F01            |    move.b    d1,-(sp)
  10.     instruction 0xA81A
  11. }
  12.  
  13. // system 7.0 or later
  14. HCreateResFile :: !Int !Int !{#Char} !Toolbox -> Toolbox;
  15. HCreateResFile vRefNum dirID fileName t = code (vRefNum=W,dirID=L,fileName=S,t=U)(t2=Z){
  16.     instruction 0xA81B
  17. }
  18.  
  19. CloseResFile :: !Int !Toolbox -> Toolbox;
  20. CloseResFile refNum t = code (refNum=W,t=U)(t2=Z){
  21.     instruction    0xA99A
  22. }
  23.  
  24. AddResource :: !Handle !{#Char} !Int !{#Char} !Toolbox -> Toolbox;
  25. AddResource theData theType theID name t = code (theData=L,theType=A1,theID=D1,name=A0,t=U)(t2=Z){
  26.     instruction 0x2F29 0x0008    |    move.l    8(a1),-(sp)
  27.     instruction 0x3F01            |    move.w    d1,-(sp)
  28.     instruction 0x4868 0x0007    |    pea        7(a0)    
  29.     instruction    0xA9AB
  30. }
  31.  
  32. ResError :: !Toolbox -> (!Int,!Toolbox);
  33. ResError t = code (t=R2U)(res_error=W,t2=Z){
  34.     instruction 0xA9AF
  35. }
  36.  
  37. Get1Resource :: !{#Char} !Int !Toolbox -> (!Handle,!Toolbox);
  38. Get1Resource theType index t = code (theType=R4A0,index=D1,t=u)(handle=L,t2=Z){
  39.     instruction 0x2F28 0x0008    |    move.l    8(a0),-(sp)
  40.     instruction 0x3F01            |    move.w    d1,-(sp)
  41.     instruction    0xA81F
  42. }
  43.  
  44. RemoveResource :: !Handle !Toolbox -> Toolbox;
  45. RemoveResource handle t = code (handle=L,t=U)(t2=Z){
  46.     instruction 0xA9AD
  47. }
  48.